Add generic WebDAV metadata cache - #646
Conversation
|
hey @taglia! WebDavCacheService changes that behavior by serving cached metadata and directory listings for up to 2 minutes without any backend validation. Invalidation only happens for changes made through this same WebDAV instance, so changes from the web app, another device, or another CLI/WebDAV instance could leave us serving stale ("phantom") entries until the TTL expires. I think that's a regression compared to the current behavior. My main concern is that as we need to keep validating cache hits against the backend to guarantee correctness, I'm not sure this cache provides enough benefit over what we already have today. I'd like to hear your thoughts before deciding whether to merge this PR 🤔 |
|
Hi @larryrider, Thanks, that makes sense. I agree that serving cached metadata/listings without backend validation can introduce phantom entries when Drive is modified outside this WebDAV instance. Given that correctness trade-off, I do not think this PR should be merged as-is. The two other PRs cover the safer generic improvements, and I’ll retest performance with only those changes before deciding whether a narrower cache proposal is still useful. If we revisit this, I’d constrain it to an approach that preserves backend validation semantics rather than returning authoritative cached entries. I will close this and test probably next week, I have a large backup in progress now and Hyper Backup can only run one at a time. |
Summary
This adds a short-lived generic metadata cache for WebDAV item lookups and folder listings.
The cache is used by WebDAV handlers for repeated
PROPFIND,GET,HEAD,PUT,DELETE,MOVE, andMKCOLlookup paths, and is invalidated on write operations.Why
WebDAV clients often issue repeated metadata requests for the same paths during backup and restore workflows. Without a short-lived cache, these requests repeatedly hit Drive metadata APIs even when the state has just been fetched or mutated by the same WebDAV process.
Behavior
Tests